import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class WorkerTest {
    public static void main(String[] args) {
        List<Worker> list = new ArrayList<>();
        list.add(new Worker("凤姐", 18, 20000));
        list.add(new Worker("欧阳锋", 60, 8000));
        list.add(new Worker("刘德华", 40, 30000));

        System.out.println("-----------------1-----------------");
        for (Worker worker : list) {
            System.out.println(worker.toString());
        }
        list.add(1, new Worker("张柏芝", 35, 3300));
        System.out.println("-----------------2-----------------");
        for (Worker worker : list) {
            System.out.println(worker.toString());
        }
        list.remove(3);
        System.out.println("-----------------3-----------------");
        for (Worker worker : list) {
            System.out.println(worker.toString());
        }
        System.out.println("-----------------迭代器-----------------");
        for(Iterator it = list.iterator(); it.hasNext();){
            System.out.println(it.next().toString());
        }
    }
}
